import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { dateTransformer } from '../../../../common/utils';

@Entity('alarm_clock', {
  comment: '闹钟表，存储用户设置的各类闹钟信息',
})
export class ClockEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: 'id' })
  public id: number;

  @Column({ type: 'int', name: 'user_id', default: null, comment: '用户ID' })
  public userId: number;

  @Column({ type: 'varchar', name: 'name', default: '', comment: '模板名称' })
  public name: string;

  @Column({ type: 'int', name: 'hour', default: null, comment: '小时' })
  public hour: number;

  @Column({ type: 'int', name: 'minute', default: null, comment: '分钟' })
  public minute: number;

  @Column({ type: 'varchar', name: 'repeat_days', default: '', comment: '重复日期（如“周一,周二,周三”）' })
  public repeatDays: string;

  @Column({ type: 'tinyint', name: 'is_daily', default: 0, comment: '是否每日重复，0为否，1为是' })
  public isDaily: number;

  @Column({ type: 'int', name: 'template_id', default: null, comment: '模板id' })
  public templateId: number;

  @Column({ type: 'char', name: 'del_flag', default: false, comment: '删除标志' })
  public delFlag: string;

  @CreateDateColumn({ type: 'datetime', name: 'create_time', default: null, transformer: dateTransformer, comment: '创建时间' })
  public createTime: Date;

  @UpdateDateColumn({ type: 'datetime', name: 'update_time', default: null, transformer: dateTransformer, comment: '更新时间' })
  public updateTime: Date;

  @Column({ type: 'char', name: 'status', default: '1', length: 1, comment: '状态' })
  public status: string;
}
